package com.lwl.leetcode;

/**
 * @author lwl
 * @Description TODO
 * @date 2025/9/29 16:01
 */
public class Code27RemoveElement {
    public int removeElement(int[] nums, int val) {
        if (nums == null || nums.length <= 0) {
            return 0;
        }
        int index = 0;
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] == val) {
                continue;
            }
            nums[index++] = nums[i];
        }
        return index;
    }
}
